package cn.jaye.fabric.controller.rest;

import cn.jaye.fabric.application.command.ListPeerByChannelCommand;
import cn.jaye.fabric.common.util.KeyUtil;
import cn.jaye.fabric.common.util.ResultUtil;
import cn.jaye.fabric.domain.model.ChainCode;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/6/2.
 */
@RestController
@RequestMapping("block")
public class BlockController {

    @PostMapping("/list")
    public String list() {
//        System.out.println(data);
//        ListPeerByChannelCommand listPeerByChannelCommand = JSON.parseObject(data, ListPeerByChannelCommand.class);
        List<JSONObject> chainCodes = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("peerName", "dd");
            jsonObject.put("tlsFlag", true);
            chainCodes.add(jsonObject);
        }
//        chainCodeApplicationService.list();
        return ResultUtil.success(chainCodes);
    }
}
